#coding=utf-8
'''
Created on 2015��9��12��

@author: 404158
'''
from selenium import webdriver
import time
import DQArouter.xiaomi_R1D.configure

def Login():
    try:
        RouterIp = DQArouter.xiaomi_R1D.configure.GetRouterIp()
        Driver = webdriver.Firefox()
        Driver.get(RouterIp)
        Driver.maximize_window()
        Driver.implicitly_wait(30)
        Driver.find_element_by_id("rtpassword").clear()
        time.sleep(1)
        Driver.find_element_by_id("rtpassword").send_keys("password")
        time.sleep(1)
        Driver.find_element_by_id("btnRtSubmit").click()
        time.sleep(2)
        return Driver
    except:
        Driver.quit()
        time.sleep(3)
        Login()
    
if __name__=='__main__':
    Login()
